﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta http-equiv="Pragma" content="no-cache,no-store" />
    <meta http-equiv="Cache-Control" content="no-cache,no-store" />
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>首页</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="renderer" content="webkit">
    <link href="/CSS/bootstrap3.3.5/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="/CSS/font-awesome-4.3.0/css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="/JqueryPlug/gridstack/dist/gridstack.css" />
    <link href="/CSS/Base/BaseClass.css" rel="stylesheet" type="text/css" />
    <script src="/Scripts/jquery-1.11.2.min.js"></script>
    <script src="/JqueryPlug/layer/layer/layer.js"></script>
    <script src="/Scripts/jqueryui.js"></script>
    <script src="/Scripts/lodash.min.js"></script>
    <script src="/JqueryPlug/gridstack/dist/gridstack.js"></script>
    <script src="/Scripts/avalon.min.js"></script>
    <script src="/Scripts/SZHLCommon.js"></script>
    <script src="/CSS/bootstrap3.3.5/js/bootstrap.min.js"></script>
    <style>
        .nopard {
            padding: 0;
        }

        i {
            color: crimson;
        }

        .sycd:hover {
            background: #eff3f9;
        }

        .pCard {
            min-width: 80px;
            text-align: center;
            margin: 8px 3px;
        }

        .pCardSel {
            background-color: #1B9AF7;
        }

            .pCardSel .pName {
                color: white;
            }
              blockquote:hover {
            border-color: #66c9f3;
            box-shadow: 0 0 10px #66c9f3;
        }

        .mangdb {
            visibility: collapse;
        }

        .pldate {
            visibility: collapse;
        }

        blockquote:hover .mangdb {
            visibility: visible;
        }

        .plspan:hover .pldate {
            visibility: visible;
        }
    </style>
    <script>
        var indexModel = avalon.define({
            $id: "indexPage",
            widgetstatus: false,
            username: ComFunJS.getnowuser(),
            widgetdata: localStorage.getItem("widgetdata") ? $.parseJSON(localStorage.getItem("widgetdata")) : [
                { "x": 0, "y": 4, "width": 7, "height": 5, "show": true, "title": "任务待办", "id": "widget2", "sort": 3, "temphtml": "tpRCTX", "urlType": "APP_RCTX" },
                { "x": 7, "y": 3, "width": 5, "height": 6, "show": true, "title": "个人文档", "id": "widget3", "sort": 2, "temphtml": "tpQYWD", "urlType": "QYWD/APP_QYWD_GR" },
                { "x": 7, "y": 0, "width": 5, "height": 3, "show": true, "title": "企业公告", "id": "widget1", "sort": 1, "temphtml": "tpQYGG", "urlType": "APP_QYGG" },
                { "x": 0, "y": 0, "width": 7, "height": 4, "show": true, "title": "流程审批", "id": "widget4", "sort": 0, "temphtml": "tpLCSP", "urlType": "APP_LCSP" }
            ],
            UploadHeadImage: function () {
                parent.ComFunJS.winviewform("/View/Common/UploadTX.html", "头像上传", "700", "570");
            },
            UserData: {},
            GetUserData: function () {
                $.getJSON('/API/SZHLAPI.ashx?Action=GETUSERBYUSERNAME', { P1: ComFunJS.getnowuser() }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        indexModel.UserData = resultData.Result;
                    }
                })
            },
            ModifyPwd: function (dom) {
                var pwd = $("#newPwd").val();
                var pwd2 = $("#newPwd2").val();
                var retmsg = "";
                if ($("#UpdateNameModal .szhl_require")) {
                    $("#UpdateNameModal .szhl_require").each(function () {
                        if ($(this).val() == "") {
                            retmsg = $(this).parent().find("label").text() + "不能为空";
                        }
                    })
                }
                if (retmsg !== "") {
                    layer.tips(retmsg, dom);
                    return;
                }
                if (pwd != pwd2) {
                    retmsg = "确认密码不一致";
                    layer.tips(retmsg, dom);
                    return;
                }
                $.post("/API/SZHLAPI.ashx?Action=MODIFYPWD", { P1: pwd, P2: pwd2 }, function (result) {
                    var jsonresult = $.parseJSON(result)
                    $(dom).removeClass("disabled").find("i").hide();
                    if ($.trim(jsonresult.ErrorMsg) != "") {
                        parent.ComFunJS.winwarning(jsonresult.ErrorMsg);
                    } else {
                        parent.ComFunJS.winsuccess("操作成功");
                        $('#UpdateNameModal').modal('hide');
                    }
                });
                $("#newPwd").val("");
                $("#newPwd1").val("");
            },
            ModifyUser: function (dom) {
                var retmsg = "";
                if ($("#UpdateUserSignModel .szhl_require")) {
                    $("#UpdateUserSignModel .szhl_require").each(function () {
                        if ($(this).val() == "") {
                            retmsg = $(this).parent().find("label").text() + "不能为空";
                        }
                    })
                }
                if (retmsg !== "") {
                    layer.tips(retmsg, dom);
                    return;
                }

                indexModel.UserData.Usersign = $("#userSign").val();
                var modelValue = JSON.stringify(indexModel.UserData.$model);
                $.post("/API/SZHLAPI.ashx?Action=ADDUSER", { P1: modelValue }, function (result) {
                    var jsonresult = $.parseJSON(result)
                    $(dom).removeClass("disabled").find("i").hide();
                    if ($.trim(jsonresult.ErrorMsg) != "") {
                        parent.ComFunJS.winwarning(jsonresult.ErrorMsg);
                    } else {
                        parent.ComFunJS.winsuccess("操作成功");
                        $('#UpdateUserSignModel').modal('hide');
                    }
                });
            },
            QYGGData: [],
            RWDBData: [],
            GRWDData: [],
            GetIndexData: function () {
                $.getJSON('/API/FTAPI.ashx?Action=GETUSERINDEXDATA', function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        indexModel.QYGGData = resultData.Result;
                        indexModel.RWDBData = resultData.Result1;
                    }
                })
            },
            //公告
            ViewQYGG: function (Id) {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_QYGG_VIEW.html?ID=" + Id, "查看数据", "1000", "");
            },
            //代办事项Start
            ModityRCTX: function (Id) {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD.html?FormCode=RCTXADD&FrameName=frameRCTX&ID=" + Id, "添加数据", "1000", "");
            },
            deltx: function (el, event) {
                event.stopPropagation();
                parent.ComFunJS.winconfirm('你确定要删除此待办吗？', function () {
                    $.getJSON("/API/FTAPI.ashx?Action=DELRWDB", { P1: el.ID }, function (resultData) {
                        if (resultData.ErrorMsg == "") {
                            model.CommonData.remove(el);
                            parent.ComFunJS.winsuccess('删除成功');
                        }

                    });
                }, function () { })
            }, enterDB: function (el, dom) {
                if ($(dom).parent().find('.dbztinfo').is(":hidden")) {
                    $('.dbztinfo').hide('fast');
                    $(dom).parent().find('.dbztinfo').show('fast')
                } else {
                    $(dom).parent().find('.dbztinfo').hide('fast')
                }

            },
            addPL: function (el, dom, event) {
                if (event) {
                    event.stopPropagation();
                }
                var content = $(dom).parent().find(".plnr").val();
                if (content == "") {
                    toastr.error('内容不能为空哦')
                } else {
                    $.post('/API/FTAPI.ashx?Action=ADDCOMENT', { "P1": content, "MsgType": "RCTX", "MsgLYID": el.ID }, function (result) {
                        var result = $.parseJSON(result);
                        if (result.ErrorMsg == "") {
                            el.PLList.push(result.Result)
                            $(dom).parent().find(".plnr").val("")
                        }
                    })
                }

            },
            //键盘提交事件
            jptj: function (el, dom, event) {
                if (event.ctrlKey && (event.keyCode == 13 || event.keyCode == 10)) {
                    var btn = $(dom).parent().find(".btnaddPL")[0];
                    model.addPL(el, btn);

                }
            },
            completeDB: function (el, event, dom) {//修改待办状态
                event.stopPropagation();
                var ISComplete = dom.checked ? "1" : "0";
                if (ISComplete == "1") {
                    $(dom).parent().parent().parent().parent().css({ background: "paleturquoise" });
                } else {
                    $(dom).parent().parent().parent().parent().css({ background: "transparent" });
                }
                $.getJSON('/API/FTAPI.ashx?Action=COMPLETERCTX', { "P1": el.ID, "P2": ISComplete }, function (result) {
                    if (result.ErrorMsg == "") {
                        parent.ComFunJS.winsuccess("操作成功");
                    }
                })
            },//代办事项End 
            syset: function () {
                $("#syset").slideToggle('normal');
            },
            setitem: function (item) {
                item.show = !item.show;
            }, OpenFrameURL: function (Type,title) {
                if ($("li[appcode='" + Type + "']").length > 0) {
                    $("li[appcode='" + Type + "']").trigger('click');
                }
                else {
                    parent.addNewTab('/View/APPBaseView/' + Type + '.html', Type, title)
                    parent.openframe('/View/APPBaseView/' + Type + '.html', Type)
                }
            }
        })

        var rootpath = "";
        avalon.ready(function () { 
            ComFunJS.initsetajax();
            indexModel.GetUserData();
            indexModel.GetIndexData();
            initdata();
            var options = {
                animate: true
            };

            $('.grid-stack').gridstack(options);
            $('.grid-stack').on('change', function (e, items) {
                $.each(items, function (i, n) {
                    var widetid = $(n.el).attr("id");
                    $.each(indexModel.widgetdata, function (h, m) {
                        if (m.id == widetid) {
                            m.sort = i;
                            m.width = n.width;
                            m.height = n.height;
                            m.x = n.x;
                            m.y = n.y;
                        }
                    })
                });
                indexModel.widgetdata.sort(function (a, b) {
                    return a.sort < b.sort;
                })
                localStorage.setItem("widgetdata", JSON.stringify(indexModel.widgetdata.$model));

            });
        })
        function initdata() {
            $.getJSON('/API/FTAPI.ashx?Action=COLLECTLIST', { P1: "" }, function (resultData) {//P1为个人文件夹
                if (resultData.ErrorMsg == "") {
                    resultData.Result.forEach(function (item) {
                        item.issel = false;
                        item.type = "folder";
                    })
                    resultData.Result1.forEach(function (item) {
                        item.issel = false;
                        item.type = "file";

                    })
                    model.ListData = resultData.Result.concat(resultData.Result1);
                    model.SelItemData.clear();
                    model.Pathdata.clear();
                }
            })
        }
    </script>

    <script src="/Scripts/contextmenu.js"></script>
    <script src="/View/APPBaseView/QYWD/avalfile.js"></script>
</head>
<body ms-controller="indexPage">
    <script type="avalon" id="tpQYGG">
        <table class="table" style="background-color:transparent">
            <tr style="text-align:left" ms-repeat-item="QYGGData">
                <td>【{{item.remark}}】<a href="javascript:void(0)" ms-click="ViewQYGG(item.ID)">{{ComFunJS.convstr(item.GGTitle,15) }}</a><span style="float:right">{{item.CRDate}}</span></td>
            </tr>
        </table>
    </script>
    <script type="avalon" id="tpQYWD">
        <div ms-controller="APP_QYWD">
            <ol class="breadcrumb text-left" style="margin-bottom:0;font-weight:bold;background-color:white;">
                <li onclick="initdata()"><a href="#">我的收藏</a></li>
                <li ms-repeat-path="Pathdata" ms-class="active:path.active" ms-click="gopath(path)"><a href="#">{{path.Name}}</a></li>
            </ol>
            <ul class="listContent wdlist" style="margin-top:10px">
                <li class="lifile hvr-float-shadow" ms-repeat-item="ListData" ms-class-1="selli:item.issel" ms-on-mousedown="filecontextmenu(item,event)" data-repeat-rendered="filechange" ms-on-dblclick="viewitem(item,$(this))" ms-attr-title="item.CRDate">
                    <span class="badge newbadge" ms-if="ComFunJS.daysBetween(ComFunJS.getnowdate('yyyy-mm-dd'), item.CRDate.substring(0,10)) == 0||ComFunJS.daysBetween(ComFunJS.getnowdate('yyyy-mm-dd'), item.CRDate.substring(0,10)) == -1">新</span>
                    <i ms-click="selItems(item,event)" class="fa" ms-class-1="fa-square-o:!item.issel" ms-class-2="fa-check-square:item.issel"></i>
                    <img class="fileimg" ms-attr-itemid="item.ID" ms-src="/images/NewIndex/qywd/{{item.type=='folder'?'file1':item.FileExtendName}}.png" onerror="javascript: this.src = '/images/NewIndex/qywd/file.png'">
                    <!--ms-class-1="copy:(PasteData>0&&PasteData[0].copycutid==item.ID)"-->
                    <span class="link-logo" ms-if="item.ShareCode||item.ViewAuthUsers||item.DownloadAuthUsers||item.UploadaAuthUsers"></span>
                    <i class="fa fa-heart" ms-if="item.CollectUser.indexOf(model.nowuser) >= 0" style="font-size:12px;  line-height: 30px;"></i> <input type="text" ms-click="selItem(item,event)" ms-attr-itemid="item.ID" ms-attr-value="item.Name" style="width:70px;border:0;background-color:transparent; margin-top:5px" ms-on-blur="updatename(item,$(this))" />
                </li>
            </ul>
        </div>
    </script>
    <script type="avalon" id="tpRCTX">
        <blockquote style="padding: 5px 10px; border-left: 3px solid #8bc4ea; font-size: 14px; margin-top: 20px; margin-bottom: 10px;" ms-repeat-el="RWDBData">
            <p style="margin-bottom: 0; font-weight: bold; padding-bottom: 4px;" ms-on-click="enterDB(el,this)">
                <span style="color: brown;">【{{el.LeiBie}}】{{ComFunJS.convstr(el.RWTitle,40)}}</span>
                <span class="badge" style="padding: 1px 3px; background-color: darkolivegreen;" title="评论数量" ms-if="el.PLList.size()!=0">{{el.PLList.size()}}</span>
            </p>
            <div style="min-height: 20px;">
                负责人: <span class="badge">{{ComFunJS.convertuser(el.RWFZR)}} </span>
                <span ms-if="el.RWCYR.length>0">参与人</span><span class="badge" ms-repeat-user="el.RWCYR.split(',')">{{ComFunJS.convertuser(user) }}</span>
                <span style="margin-top: 4px; color: darkgray;" ms-if="el.PLList.size()!=0">【{{el.PLList[el.PLList.size()-1].CRUserName}}】：{{ComFunJS.convstr(el.PLList[el.PLList.size()-1].MSGContent,20)}}</span>
                <span style="margin-top: 2px; float: right" ms-if="el.CRUser!=username">创建人：<b style="color: brown;">{{  ComFunJS.convertuser(el.CRUser)}}</b></span>
                <span class="mangdb pull-right">
                    <label style="margin-bottom: 0" ms-if="el.CRUser==username" ms-click="inputevent(event)">
                        <input ms-on-click="completeDB(el,event,this)" type="checkbox" class="isjs" style="vertical-align: middle; vertical-align: middle; margin-top: 0; width: 14px; height: 14px;">结束
                    </label><a href="#" class="delTX" style="margin-left: 10px;" ms-if="el.CRUser==username" ms-click="deltx(el,event)">删除</a><a href="#" class="UpTX" style="margin-left: 10px;" ms-attr-dataid="el.ID" ms-attr-dbnr="el.Name" ms-attr-leibie="el.LeiBie" ms-attr-txdate="el.TXTime" ms-click="ModityRCTX(el.ID)" ms-attr-txr="el.TXUser" ms-visible="el.CRUser==username">修改待办事项</a>
                </span>
            </div>
            <div style="display: none; margin-top: 6px;" class="dbztinfo">
                <span style="margin-top: 4px;" ms-if="el.TXTime">
                    <img src="/images/tmp-img2.png" class="viewdb" style="width: 16px; height: 16px; margin-left: 4px;" />{{el.TXTime|date("yy年MM月dd日 HH:mm")}}
                </span>
                <span class="plspan" ms-repeat-item="el.PLList" style="padding-bottom: 6px; padding-top: 6px; font-size: 14px; color: darkgray; display: block; border-bottom: 1px dotted whitesmoke;">【{{item.CRUserName}}】：{{item.MSGContent}}<span style="float: right" class="pldate">{{item.CRDate|date("MM月dd日 HH:mm")}}</span></span>
                <div class="input-group" style="margin-top: 10px;">
                    <input type="text" class="form-control plnr" placeholder="此处输入执行状态（按Ctrl+Enter直接提交）" ms-keypress="jptj(el,this,event)" aria-describedby="sizing-addon3" ms-on-click="inputevent(event)">
                    <span class="input-group-addon btnaddPL" id="sizing-addon3" ms-on-click="addPL(el,this,event)">+添加</span>
                </div>
            </div>
        </blockquote>
    </script>
    <script type="avalon" id="tpLCSP">
        <ul class="list-group">
            <li class="list-group-item">Cras justo odio</li>
            <li class="list-group-item">Dapibus ac facilisis in</li>
            <li class="list-group-item">Morbi leo risus</li>
            <li class="list-group-item">Porta ac consectetur ac</li>
            <li class="list-group-item">Vestibulum at eros</li>
        </ul>
    </script>
    <div class="container-fluid contentdv" style="margin-top: 20px" id="dvContent">
        <div style="width:200px;position:absolute">
            <div class="box">
                <div class="box-content text-center nopard">
                    <img alt="" class="img-rounded" onerror="javascript: this.src = '/images/TX/default.png'" ms-attr-src="'/images/TX/'+UserData.UserName+'.jpg'" style="width:65px;height:65px;margin-top:5px;" onerror="javascript: this.src = '/images/TX/default.png'">
                    <div style="padding:0 10px 5px 10px">
                        <address style="margin-bottom:0">
                            <strong>{{UserData.UserRealName}}{{UserData.zhiwu==''?'': '【'+UserData.zhiwu+'】'}}</strong><br>
                        </address>
                        <address ms-if="UserData.Usersign!=''">
                            <strong>岗位职责</strong>:
                            {{UserData.Usersign}}
                        </address>
                    </div>
                    <table class="table" style="margin:0;background-color:transparent;">
                        <tr>
                            <td class="sycd" style="border-right:1px solid #ddd" ms-click="UploadHeadImage()">
                                <div><i class="fa fa-photo" style="font-size: 26px;"></i></div>
                                <div><a href="#">头像修改</a></div>
                            </td>
                            <td class="sycd" data-toggle="modal" data-target="#UpdateNameModal">
                                <div><i class="fa fa-flag" style="font-size: 26px;"></i></div>
                                <div><a>修改密码</a></div>
                            </td>
                        </tr>
                        <tr>
                            <td class="sycd" style="border-right:1px solid #ddd" ms-click="syset()">
                                <div><i class="fa fa-cog fa-fw" style="font-size: 26px;"></i></div>
                                <div><a href="#">首页设置</a></div>
                            </td>
                            <td class="sycd" data-toggle="modal" data-target="#UpdateUserSignModel">
                                <div><i class="fa fa-user" style="font-size: 26px;"></i></div>
                                <div><a href="#">个人资料</a></div>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
        <div class="row" style="margin-left:201px;display:none" id="syset">
            <div class="panel panel-default" style="margin:10px">
                <div class="panel-body" style="padding-top: 5px;padding-bottom: 5px;">
                    <div class="pCard" ms-repeat-item="widgetdata" ms-class-1="pCardSel:item.show" ms-click="setitem(item)">
                        <div class="pName" >{{item.title}}</div>
                    </div>
                </div>
            </div>
        </div>
        <div class="grid-stack row" style="margin-left:201px">
            <div ms-repeat-widget="widgetdata" class="grid-stack-item" ms-attr-id="widget.id" ms-data-gs-width="widget.width" ms-data-gs-x="widget.x" ms-data-gs-y="widget.y" data-gs-min-width="4" data-gs-min-height="3" ms-data-gs-height="widget.height" ms-data-gs-no-resize="widgetstatus" ms-data-gs-no-move="widgetstatus" ms-if-loop="widget.show">
                <div class="grid-stack-item-content box">
                    <div class="box-title">
                        <i class="fa fa-flag"></i>{{widget.title}}<a href="javascript:void(0)" ms-click="OpenFrameURL(widget.urlType,widget.title)" style="float:right">进入{{widget.title}}</a>
                    </div>
                    <div class="box-content  nopard" ms-include="widget.temphtml">
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade" id="UpdateNameModal" role="dialog">
        <div class="modal-dialog" role="document" style="width:500px">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">修改密码</h4>
                </div>
                <div class="modal-body">
                    <div class="form-horizontal">
                        <div class="form-group">
                            <label class="col-xs-4 control-label"><span class="Required">*</span>新密码</label>
                            <input type="password" class="form-control szhl_require" style="width:200px" id="newPwd" placeholder="请输入新密码" />
                        </div>
                        <div class="form-group">
                            <label class="col-xs-4 control-label"><span class="Required">*</span>确认密码</label>
                            <input type="password" class="form-control szhl_require" style="width:200px" id="newPwd2" placeholder="请输入确认密码" />
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-success" id="conaddForder" ms-click="ModifyPwd(this)"><i class="fa fa-spinner fa-spin" style="display:none"></i> 确&nbsp;&nbsp;认</button>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade" id="UpdateUserSignModel" role="dialog">
        <div class="modal-dialog" role="document" style="width:500px">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">修改岗位职责</h4>
                </div>
                <div class="modal-body">
                    <div class="form-horizontal">
                        <div class="form-group">
                            <label class="col-xs-3 control-label"><span class="Required">*</span>岗位职责</label>
                            <textarea class="form-control szhl_require" style="width:300px;" rows="4" id="userSign" ms-attr-value="UserData.Usersign" placeholder="请输入岗位职责"></textarea>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-success" id="conaddForder" ms-click="ModifyUser(this)"><i class="fa fa-spinner fa-spin" style="display:none"></i> 确&nbsp;&nbsp;认</button>
                </div>
            </div>
        </div>
    </div>
    <div id="context-menu" class="conMenu">
        <ul class="dropdown-menu" role="menu">
            <li ms-click="downloaditem()"><a href="#">&nbsp;下载</a></li>
        </ul>
    </div>
</body>
</html>
